<template>
  <el-dialog
      title="详情"
      custom-class="x-large-dialog"
      :visible="visible"
      append-to-body
      @open="mixinOpen"
      @close="close"
  >
    <div class="detail-pannel">
      <div class="group-title">角色信息</div>
      <el-form>
        <el-row>
          <el-col :span="24">
            <el-form-item label="角色名称：">{{detailData.name}}</el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="权限配置" prop="auth">
              <el-tree
                  ref="tree"
                  :data="menuListCom"
                  :props="defaultProps"
                  show-checkbox
                  node-key="id"
              >
              </el-tree>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="角色描述：">{{detailData.description}}</el-form-item>
          </el-col>
        </el-row>
      </el-form>
    </div>
    <div slot="footer">
      <el-button @click="close">取 消</el-button>
    </div>
  </el-dialog>
</template>

<script>
import { _getDetail } from '../src/store'
import { detailDialog, getAllMenu } from '@/mixins'

export default {
  name: 'detailDialog',
  mixins: [detailDialog, getAllMenu],
  data() {
    return {
      detailData: {
        name: '',
        auth: '',
        description: ''
      },
      isDisabled: true,
      detailFunc: _getDetail
    }
  },
  computed: {
    menuListCom() {
      return this.menuList.map(item => {
        if (item.type === 'PC') {
          item.name = item.name + '(PC端)'
        } else {
          item.name = item.name + '(移动端)'
        }
        return item
      })
    }
  }
}
</script>

<style scoped>

</style>
